package com.example.mall.dto;

import com.example.mall.mbg.model.Supplier;

import java.text.SimpleDateFormat;

public class SupplierDto extends Supplier {

    public SupplierDto(Supplier supplier) {
        this.setSupplierid(supplier.getSupplierid());
        this.setSuppliername(supplier.getSuppliername());
        this.setAddress(supplier.getAddress());
        this.setContactname(supplier.getContactname());
        this.setContactphone(supplier.getContactphone());
        this.setEmail(supplier.getEmail());
        this.setSupplierrange(supplier.getSupplierrange());
        this.setStartdate(supplier.getStartdate());
        this.setCreatetime(supplier.getCreatetime());
        this.setUpdatetime(supplier.getUpdatetime());
    }

    public String getFmtStartDate() {
        if (getStartdate() != null) {
            SimpleDateFormat f = new SimpleDateFormat("yyyy/MM/dd");
            return f.format(getStartdate());
        } else {
            return "";
        }
    }
}
